﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EagleAI : Enemy {

    public Transform[] movePoints;
    public float speed;
    private int index = 0;
	// Use this for initialization
	protected override void  Start () {
        base.Start();
	}
	
	// Update is called once per frame
	void Update () {
        float dis = Vector2.Distance(transform.position, movePoints[index].position);
        transform.position = Vector2.MoveTowards(transform.position, movePoints[index].position,speed*Time.deltaTime);
        if (dis < 0.1f)
        {
            index++;
            if (index >= movePoints.Length)
                index = 0;
        }
	}
}
